package com.hjx.face.javacv.face;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.ActionEvent;

public class JavacvFaceMain {

	private JFrame frame;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
					JavacvFaceMain window = new JavacvFaceMain();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public JavacvFaceMain() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 351, 216);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JButton button = new JButton("注册");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				FaceRegisterApp app = new FaceRegisterApp();
				app.getFrame().addWindowListener(new WindowAdapter() {
					@Override
					public void windowClosing(WindowEvent e) {
						frame.setVisible(true);
					}
				});
				app.open(2);
				frame.setVisible(false);
			}
		});
		button.setBounds(55, 60, 93, 23);
		frame.getContentPane().add(button);
		
		JButton button_1 = new JButton("锁屏");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				FaceRecognitionApp app = new FaceRecognitionApp();
				app.getFrame().addWindowListener(new WindowAdapter() {
					@Override
					public void windowClosing(WindowEvent e) {
						frame.setVisible(true);
					}
				});
				app.getFrame().setVisible(true);
				frame.setVisible(true);
			}
		});
		button_1.setBounds(182, 60, 93, 23);
		frame.getContentPane().add(button_1);
	}
}
